//package com.whxd.system.role.repository;
//
//import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
//import org.springframework.data.repository.PagingAndSortingRepository;
//
//import com.whxd.system.role.entity.Role;
//
//public interface RoleDao extends PagingAndSortingRepository<Role, Long>, JpaSpecificationExecutor<Role> {
//
////	Page<Task> findByUserId(Long id, Pageable pageRequest);
////
////	@Modifying
////	@Query("delete from Task task where task.user.id=?1")
////	void deleteByUserId(Long id);
//	
////	/**
////	 * 分页查找所有角色
////	 * 
////	 */
////	@SuppressWarnings("unchecked")
////	public static PageResult<Role> findAllByPage(PageParam page) {
////		Query query = em().createQuery("select r from Role r");
////		Query queryCount = em().createQuery("select count(r) from Role r");
////		PageResult<Role> result = new PageResult<Role>();
////		// 填充分页信息
////		query.setFirstResult(page.getFirstResult()).setMaxResults(
////				page.getRows());
////		// 返回结果
////		result.setTotal((Long) queryCount.getSingleResult());
////		result.setRows(query.getResultList());
////		return result;
////	}
////
////	/**
////	 * 查询所有角色
////	 */
////	@SuppressWarnings("unchecked")
////	public static List<Role> findAll() {
////		return em().createQuery("select r from Role r").getResultList();
////	}
////
////	/**
////	 * 根据id查询角色
////	 */
////	public static Role findById(Long id) {
////		return em().find(Role.class, id);
////	}
////
////
////	/**
////	 * 根据角色id查找相应权限
////	 * 
////	 * @author 张世鹏
////	 * @since 2013-6-8
////	 * @param roleId
////	 * @return
////	 */
////	public static List<Authority> findAuthorityById(Long roleId) {
////		try {
////			Role role = em().find(Role.class, roleId);
////			return role.getAhthoritys();
////		} catch (NoResultException ne) {
////			return null;
////		}
////
////	}
////
////	/**
////	 * 根据角色id查找相应菜单
////	 * 
////	 * @author 张世鹏
////	 * @since 2013-6-8
////	 * @param id
////	 * @return
////	 */
////	@SuppressWarnings("unchecked")
////	public static List<Menu> findMenuByRoleId(Long roleId) {
////		Query query = em()
////				.createQuery(
////						"select distinct m from Role r INNER JOIN r.menus m where r.id=:id and m.enabled=true order by m.order");
////		query.setParameter("id", roleId);
////		return query.getResultList();
////	}
////
////	/**
////	 * 根据传入的id数组查选role
////	 * 
////	 * @author 张世鹏
////	 * @since 2013-6-19
////	 * @param roleIds
////	 * @return
////	 */
////	@SuppressWarnings("unchecked")
////	public static List<Role> findByIds(String roleIds) {
////		if (StringUtils.isBlank(roleIds)) {
////			return null;
////		}
////		Query query = em().createQuery(
////				"select distinct r from Role r where r.id in(" + roleIds + ")");
////		return query.getResultList();
////	}
//
//}
